#ifndef _C38BEB4A_BCF6_4398_83CD_46787EAE5035
#define _C38BEB4A_BCF6_4398_83CD_46787EAE5035

#include "incfile.h"
#ifdef __X2LIB_CLOSE__
#include "winapi.h"
#endif

#if defined(__X2LIB_LINUX__) || defined(__X2LIB_MACOS__)
#define putch		putchar // linux 没有putch
#define getch		getchar // linux 没有getch
static int kbhit(void)  
{  
	struct termios oldt, newt;  
	int ch;  
	int oldf;  
	tcgetattr(STDIN_FILENO, &oldt);  
	newt = oldt;  
	newt.c_lflag &= ~(ICANON | ECHO);  
	tcsetattr(STDIN_FILENO, TCSANOW, &newt);  
	oldf = fcntl(STDIN_FILENO, F_GETFL, 0);  
	fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK);  
	ch = getchar();  
	tcsetattr(STDIN_FILENO, TCSANOW, &oldt);  
	fcntl(STDIN_FILENO, F_SETFL, oldf);  
	if(ch != EOF)  
	{  
		ungetc(ch, stdin);  
		return 1;  
	}  
	return 0;  
}  
#endif

#ifndef MAX
#define MAX(a,b)            (((a) > (b)) ? (a) : (b))
#endif

#ifndef MIN
#define MIN(a,b)            (((a) < (b)) ? (a) : (b))
#endif

#endif

